from datetime import datetime

times = [
    '08:30-09:15',
    '09:15-09:25',
    '09:25-10:10',
    '10:10-10:20',
    '10:20-11:05',
    '11:05-11:15',
    '11:15-12:00',
    '12:00-13:50',
    '13:50-14:35',
    '14:35-14:45',
    '14:45-15:30',
    '15:30-15:40',
    '15:40-16:25',
    '16:25-16:35',
    '16:35-17:20',
    '17:20-18:30',
    '18:30-19:15',
    '19:15-19:25',
    '19:25-20:10',
    '20:10-20:20',
    '20:20-21:00',
]


class Time:
    def __init__(self):
        self.time=datetime.now()

    def start_time(self,time):

        start = datetime.strptime(str(datetime.now().date()) + time, "%Y-%m-%d%H:%M")

        return start

    def end_time(self,time):

        end = datetime.strptime(str(datetime.now().date()) + time, "%Y-%m-%d%H:%M")

        return end

    def now(self):
        for i in times:
            start= Time().start_time(i[:5])
            end=Time().end_time(i[-5:])

            if start< self.time < end:
                m=str(end - self.time).split(':')[1]
                s=str(end - self.time).split(':')[2][:2]
                print(f'现在是上课时间距离结束{m}分钟{s}秒')
                break
            if end < self.time < start:
                m = str(end - self.time).split(':')[1]
                s = str(end - self.time).split(':')[2][:2]
                print(f'现在是下课时间距离结束{m}分钟{s}秒')
                break

if __name__ == '__main__':
    Time().now()